package test;

import java.io.File;

import fr.cephb.joperon.core.Mode;
import fr.cephb.joperon.core.Operon;
import fr.cephb.lang.Endian;

/*
 
 A simple connection to operon in read only
 
 
 */
public class Example001
	{
	public static void main(String[] args)
		{
		Endian.setDefault(Endian.CNG);
		Operon operon=null;
		try {
			//connect to operon in read only mode
			operon= Operon.newInstance(
					new File(Operon.DB_HOME_DEFAULT), // the BerkeleyDB home environment
					Mode.READ_ONLY //read only mode, no insertion allowed
					);
			/* this could be simplified by;
			
			operon= Operon.newInstance();
			 
			 */
			
			} 
		catch (Exception e) {
			//print error if any
			e.printStackTrace();
			}
		finally
			{
			//ALWAYS close operon
			if(operon!=null) operon.safeClose();
			}
		}
	}
